#pragma once

#include <vector>
#include <iterator>

#include "IDependencyBinding.h"

using namespace std;

class BindingList
{
public:
	void Add(IDependencyBinding* binding);

	template <class Type>
	vector<IDependencyBinding*> GetBindings();
private:
	vector<IDependencyBinding*> bindings;
};

template <class Type>
vector<IDependencyBinding*> BindingList::GetBindings()
{
	vector<IDependencyBinding*> returnedBindings;
	vector<IDependencyBinding*>::iterator it;

	for (it=this->bindings.begin();it!=this->bindings.end();++it)
	{
		if (dynamic_cast<DependencyBinding<Type>*>(*it) != nullptr)
		{
			returnedBindings.push_back((*it));
		}
	}

	return returnedBindings;
}

